package reduce.fz.com.reduce.fragment;


import android.os.Bundle;
import android.app.Fragment;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;

import reduce.fz.com.reduce.R;
import reduce.fz.com.reduce.bean.Team;

public class TeamStoryFragment extends BaseViewPagerFragment implements View.OnClickListener {
    private Team team;
    private StoryRecommendFragment fragment;


    public TeamStoryFragment()
    {

    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        team= (Team) getArguments().getSerializable("team");
        attachDynamicListFragment();
    }

    public static TeamStoryFragment create(Team team,int position) {
        TeamStoryFragment fragment = new TeamStoryFragment();
        Bundle bundle = new Bundle();
        bundle.putSerializable("team", team);
        bundle.putInt(BUNDLE_FRAGMENT_INDEX, position);
        fragment.setArguments(bundle);
        return fragment;
    }

    public void attachDynamicListFragment() {

        fragment = StoryRecommendFragment.create(team);
        getChildFragmentManager().beginTransaction().replace(R.id.team_story_list_container, fragment).commit();
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        return inflater.inflate(R.layout.fragment_team_story, container, false);
    }


    @Override
    public void onClick(View v) {

    }

    @Override
    public boolean isViewBeingDragged(MotionEvent event) {
        return fragment.isViewBeingDragged(event);
    }
}
